<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
	prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
	prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"
	prefix="logic"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>JSP for ModifyatomForm form</title>
		<LINK href="images/main.css" type=text/css rel=stylesheet>
		<style type="text/css">
		* { margin:0; padding:0;}
		BODY {SCROLLBAR-FACE-COLOR: #f2f2f2; SCROLLBAR-HIGHLIGHT-COLOR: #f2f2f2; SCROLLBAR-SHADOW-COLOR: #b7b7b7; SCROLLBAR-3DLIGHT-COLOR: #f2f2f2; SCROLLBAR-ARROW-COLOR: #999999; SCROLLBAR-TRACK-COLOR: #e9e9e9; SCROLLBAR-DARKSHADOW-COLOR: #f2f2f2; SCROLLBAR-BASE-COLOR: #f2f2f2}
		#id1{width:100%;height:100%;background-color:#000;FILTER: alpha(opacity=50);position:absolute;top:0;left:0; moz-opacity: 0.8;opacity: .80;z-index:49;display:none;}
		#id2{top:200px;position:absolute;z-index:50;display:none;border:3px solid #E5E5E5; left:100px;background-color:white;}
		</style>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title></title>
		<script language="javascript" type="text/javascript">
		function show(){
		id1.style.height=document.body.scrollHeight+"px";
		id1.style.width=document.body.scrollWidth+"px";
		id1.style.display='block';
		id2.style.display='block';
		}
		function hide(){
		id1.style.display='none';
		id2.style.display='none';
		}
		function opchange(o){
		document.modifyatomForm.operation.value=o;
		var id=document.all.checkid;
		var count=0;
		var sel=null;
		for(i=0;i<id.length;i++){
			if(id[i].checked==true){
				count++;
				sel=id[i].value;
			}
		}
		if (count>0&&o=="del"){
			if(confirm("是否删除？")){
				document.modifyatomForm.submit();
			}
		}else if(o=="del"&&count==0){
			alert("请勾选要删除的项目");		
		}else if(o=="add"){
			show();
		}else if(o=="modbox"&&count==1){
			document.modifyatomForm.submit();
		}else {
			alert("请选则单个项目且修改!");
			}
		}
		function cancelsub(){
			hide();
		}
		self.onError=null;                              
		currentX = currentY = 0;                               
		whichIt = null;                                         
		lastScrollX = 0; lastScrollY = 0;                              
		NS = (document.layers) ? 1 : 0;                             
		IE = (document.all) ? 1: 0;                              
		<!-- STALKER CODE -->                              
		function heartBeat() {                              
		if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
		if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }           
		if(diffY != lastScrollY) {            
		percent = .1 * (diffY - lastScrollY);    
		if(percent > 0) percent = Math.ceil(percent); 
		else percent = Math.floor(percent);  
		if(IE) document.all.id2.style.pixelTop += percent;  
		if(NS) document.id2.top += percent;                 
		lastScrollY = lastScrollY + percent;      
		}                       
		if(diffX != lastScrollX) {       
		percent = .1 * (diffX - lastScrollX);     
		if(percent > 0) percent = Math.ceil(percent);       
		else percent = Math.floor(percent);                   
		if(IE) document.all.id2.style.pixelLeft += percent;        
		if(NS) document.id2.left += percent;       
		lastScrollX = lastScrollX + percent;                     
		}                           
		}                         
		<!-- /STALKER CODE -->              
		<!-- DRAG DROP CODE -->              
		function checkFocus(x,y) {         
		stalkerx = document.id2.pageX;     
		stalkery = document.id2.pageY;                        
		stalkerwidth = document.id2.clip.width;              
		stalkerheight = document.id2.clip.height;                         
		if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;                      
		else return false;        
		}                     
		function grabIt(e) {            
		if(IE) {                            
		whichIt = event.srcElement; 
		while (whichIt.id.indexOf("id2") == -1) {    
		whichIt = whichIt.parentElement;                           
		if (whichIt == null) { return true; }         
		 }                            
		whichIt.style.pixelLeft = whichIt.offsetLeft;                              
		whichIt.style.pixelTop = whichIt.offsetTop;                          
		currentX = (event.clientX + document.body.scrollLeft);                       
		currentY = (event.clientY + document.body.scrollTop);                        
		} else {                             
		window.captureEvents(Event.MOUSEMOVE);    
		if(checkFocus (e.pageX,e.pageY)) {                            
		whichIt = document.id2;                              
		stalkerTouchedX = e.pageX-document.id2.pageX;      
		StalkerTouchedY = e.pageY-document.id2.pageY;          
		}                              
		}                            
		return true;                        
		}                            
		function moveIt(e) {               
		if (whichIt == null) { return false; }       
		if(IE) {                             
		newX = (event.clientX + document.body.scrollLeft);                           
		newY = (event.clientY + document.body.scrollTop);                
		distanceX = (newX - currentX);    distanceY = (newY - currentY);   
		currentX = newX;    currentY = newY;                       
		whichIt.style.pixelLeft += distanceX;                          
		whichIt.style.pixelTop += distanceY;                      
		if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;    if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft; if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
		if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;  
		event.returnValue = false;  
		} else {   
		whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY); 
		if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset; 
		if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;  
		if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17; 
		if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17; 
		return false;} 
		return false;  
		}   
		function dropIt() {     
		whichIt = null;     
		if(NS) window.releaseEvents (Event.MOUSEMOVE);  
		return true;             
		 }                     
		<!-- DRAG DROP CODE -->  
		if(NS) {    
		window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
		window.onmousedown = grabIt;
		window.onmousemove = moveIt; 
		window.onmouseup = dropIt; 
		}              
		if(IE) {                     
		document.onmousedown = grabIt;    
		document.onmousemove = moveIt;   
		document.onmouseup = dropIt;          
		 }                         
		if(NS || IE) action = window.setInterval("heartBeat()",1)</script>
	</head>
	<body>

		<%
		String way = request.getParameter("way");
		%>
		<html:form action="/modifyatom.do">
			<%
			if (way.equals("1")) {//list 列出已经存在的原子组
			%>
			<table id="tb" border="0" cellpadding="1" cellspacing="1"
				class="moduleList" bgcolor="#D5D5D5" align="center"
				style="display：none" width="800">
				<tr>
					<td>
						请选择：
					</td>
					<td>
						原子组名
					</td>
					<td>
						原子组描述
					</td>
					<td>
						所在菜单id
					</td>
				</tr>
				<logic:iterate name="allGroupList" id="i">
					<tr bgcolor="ffffff">
						<td>
							<input type="checkbox" name="checkid"
								value=<bean:write name="i" property="ATOM_GROUP_ID"/>>
						</td>
						<td>
							<bean:write name="i" property="ATOM_GROUP_NAME" />
						</td>
						<td>
							<bean:write name="i" property="ATOM_GROUP_DESC" />
						</td>
						<td>
							<bean:write name="i" property="BOOKMARK_ID" />
						</td>
					</tr>
				</logic:iterate>
				<%
				}
				%>
			</table>
			<%
			if (way.equals("2")) {//列出已经存在的原子
			%>
			<center>
			<table id="tb" border="0" cellpadding="1" cellspacing="1"
				class="moduleList" bgcolor="#D5D5D5" align="center"
				style="display：none" width="820">
				<tr>
					<td width="3%">
						请选择：
					<td width="15%">
						原子名
					</td>
					<td width="13%">
						原子描述
					</td>
					<td width="30%">
						代码来源表
					</td>
					<td width="34%">
						基础数据来源表
					</td>
					<td width="5%">
						原子单位标志
					</td>
				</tr>
			</table>
			<div style="width: 820px; height: 500px; overflow-y: scroll;"
				align="justify">
				<table id="tb" border="0" cellpadding="1" cellspacing="1"
					class="moduleList" bgcolor="#D5D5D5" align="center"
					style="display：none" width="800">
					<logic:iterate name="allList" id="i">

						<tr bgcolor="ffffff">
							<td>
								<input type="checkbox" name="checkid"
									value=<bean:write name="i" property="BIZ_ATOM_ID"/>>
							</td>
							<td>
								<bean:write name="i" property="BIZ_ATOM_NAME" />
							</td>
							<td>
								<bean:write name="i" property="BIZ_ATOM_DESC" />
							</td>
							<td>
								<bean:write name="i" property="CDE_SRC_TABLE_NAME" />
							</td>
							<td>
								<bean:write name="i" property="BAS_TABLE_NAME" />
							</td>
							<td>
								<bean:write name="i" property="BIZ_ATOM_FLAG" />
							</td>
						</tr>
					</logic:iterate>
					<%
					}
					%>
				</table>
				</div>
			</center>
			<div id="id2">
				<table border="0" align="center">
					<tr>
						<td>
							<div id=groupdiv>
								原子组名 :
							</div>
						</td>
						<td>
							<%
							if (way.equals("1")) {
							%>
							<html:select property="prename">
								<html:option value="">请选择菜单类</html:option>
								<html:option value="8">用户基本属性</html:option>
								<html:option value="9">用户价值属性</html:option>
								<html:option value="10">用户行为属性</html:option>
								<html:option value="11">用户竞争属性</html:option>
								<html:option value="12">用户套餐属性</html:option>
								<html:option value="13">用户定义属性</html:option>
							</html:select>
							<html:errors property="prename" />
							<%
								}
								if (way.equals("2")) {
							%>
							<html:select property="prename">
								<html:option value="">请选择原子组</html:option>
								<logic:iterate name="allGroupList" id="i">
									<option value=<bean:write name="i" property="ATOM_GROUP_ID"/>>
										<bean:write name="i" property="ATOM_GROUP_NAME" />
									</option>
								</logic:iterate>
							</html:select>
							<%
							}
							%>
						</td>
					</tr>
					<tr>
						<td>
							ID：
						</td>
						<td>
							<html:text property="BIZ_ID" />
							<html:errors property="BIZ_ID" />
						</td>
					</tr>
					<tr>
						<td>
							<div id=namediv>
								原子名称 :
							</div>
						</td>
						<td>
							<html:text property="name" />
							<html:errors property="name" />
						</td>
					</tr>
					<tr>
						<td>
							<div id=BIZ_DESCdiv>
								原子描述 :
							</div>
						</td>
						<td>
							<html:text property="BIZ_DESC" />
							<html:errors property="BIZ_DESC" />
						</td>
					</tr>

				</table>
				<%
				if (way.equals("2")) {
				%>
				<div id="addatominfo">
					<table border="0" align="center">
						<tr>
							<td>
								值类型:
							</td>
							<td>
								<html:select property="VALUE_TYPE_ID">
									<option value="1">
										数字型
									</option>
									<option value="2">
										字符型
									</option>
								</html:select>
							</td>
						</tr>
						<tr>
							<td>
								展示方式：
							</td>
							<td>
								<html:select property="SHOW_TYPE_ID">
									<logic:iterate id="showtype" name="atomShowType">
										<option
											value=<bean:write name="showtype" property="SHOW_TYPE_ID"/>">
											<bean:write name="showtype" property="SHOW_TYPE_NAME" />
										</option>
									</logic:iterate>

								</html:select>
							</td>
						</tr>
						<tr>
							<td>
								代码来源表：
							</td>
							<td>
								<html:text property="CDE_SRC_TABLE_NAME"></html:text>
							</td>
						</tr>
						<tr>
							<td>
								基础数据来源表：
							</td>
							<td>
								<html:text property="BAS_TABLE_NAME"></html:text>
							</td>
						</tr>
						<tr>
							<td>
								基础表字段名：
							</td>
							<td>
								<html:text property="BAS_TABLE_COL_NAME"></html:text>
							</td>
						</tr>
						<tr>
							<td>
								基础表字段类型：
							</td>
							<td>
								<html:text property="BAS_TABLE_COL_TYPE"></html:text>
							</td>
						</tr>
						<tr>
							<td>
								业务原子类别标识：
							</td>
							<td>
								<html:select property="ATOM_KIND_ID">

									<option value="1">
										只适用于客户
									</option>
									<option value="2">
										只适用于用户
									</option>
									<option value="3">
										适用于两者
									</option>
								</html:select>
							</td>
						</tr>
						<tr>
							<td>
								原子单位标志：
							</td>
							<td>
								<html:select property="BIZ_ATOM_FLAG">
									<option value="time">
										时间
									</option>
									<option value="money">
										钱数
									</option>
									<option value="other">
										其他
									</option>
								</html:select>
							</td>
						</tr>
						<tr>
							<td>
								源表中文字段名：
							</td>
							<td>
								<html:text property="SRC_TABLE_COL_NAME" />
							</td>
						</tr>

					</table>

				</div>

				<%
				}
				%>
				<center>
					<input type="submit" value="提交">
					<input type="button" value="取消" onclick="cancelsub()">
				</center>
			</div>
			<html:hidden property="operation" />
			<html:hidden property="way" />
			<table border="0" align="center">
				<tr>
					<td align="center" valign="middle">
						<input type="button" value="添加" onclick="opchange('add')">
						<input type="button" value="修改" onclick="opchange('modbox')">
						<input type="button" value="删除" onclick="opchange('del')">
					</td>
				</tr>
			</table>
		</html:form>
		<div id="id1"></div>
		<script type="text/javascript">
			var wayop=<%=way%>;
			document.all.way.value=wayop;
			if(wayop=="1"){
				document.all.groupdiv.innerText="所属分类菜单:";
				document.all.namediv.innerText="原子组名称:"
				document.all.BIZ_DESCdiv.innerText="原子组描述:"
			}
			if(wayop=="3"){
				document.all.groupdiv.innerText="所属原子名称:";
				document.all.namediv.innerText="原子项名称：";
				document.all.BIZ_DESCdiv.innerText="原子项描述：";
			}
		</script>
	</body>
</html>

